#include "usart.h"
#include "my_delay.h"
#include "wifi.h"

void wifiInit()
{	
	OLED_ShowString(10,20,"WIFI is connecting...",12,1);
	OLED_Refresh();

	myDelayMs(500);
	usartSendStr(USART2,"AT+CWMODE=2\r\n",sizeof("AT+CWMODE=2\r\n"));
	myDelayMs(500);

	usartSendStr(USART2,"AT+CWSAP=\"YinYuan\",\"11223344\",5,4\r\n",sizeof("AT+CWSAP=\"YinYuan\",\"11223344\",5,4\r\n"));
	myDelayMs(500);
	
	usartSendStr(USART2,"AT+CIPMUX=1\r\n",sizeof("AT+CIPMUX=1\r\n"));
	myDelayMs(500);

	usartSendStr(USART2,"AT+CIPSERVER=1,8888\r\n",sizeof("AT+CIPSERVER=1,8888\r\n"));
	myDelayMs(1000);

}

